home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / pgs3h21d.lha / 3.0h2update / Macros.LHA / AutomaticTextFrame.rexx next >
OS/2 REXX Batch file  |  1995-09-14  |  3KB  |  98 lines

  1. /* $VER: AutomaticTextFrame.rexx 1.1 (14.09.99)
  2.    Copyright 1995 Soft-Logik Publishing Corporation
  3.    May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4.  
  5. OPTIONS RESULTS
  6. ADDRESS 'PAGESTREAM'
  7.  
  8. /* Two arguments are accepted:
  9.     DEFAULT: creates a default size text frame on the next page
  10.     SAME: creates an identical size text frame on the next page
  11.     If no argument is given, SAME is assumed */
  12.  
  13. arg sMode .
  14.  
  15. /* MAIN LOOP */
  16. call OPENLIBS()
  17.  
  18. call VERIFYFRAME()        /* check and see if a text frame is selected */
  19. call GETFRAMEINFO()        /* get info on the current frame */
  20.  
  21. 'refresh wait'
  22. display page iCurrentPage+1
  23.  
  24. if sMode = DEFAULT then do        /* DEFAULT */
  25.     'createcolumns default page 'iCurrentPage+1
  26.         hFrameNew=result
  27.     end
  28. else do                            /* SAME */
  29.     sCoord=sPos.left' 'sPos.top' 'sPos.right' 'sPos.bottom' skew 'sPos.slant' 'sPos.twist' columns 'number' gutter 'space
  30.     if sPos.mode=POINT then sCoord=sCoord' about 'sPos.x' 'sPos.y
  31.     'drawcolumn 'sCoord
  32.         hFrameNew=result
  33. end
  34.  
  35. if cflag=ON then 'editobject constrain'
  36. if pflag=OFF then 'editobject noprint'
  37.  
  38. /* LINK THE FRAMES */
  39. 'settextrouting from objectid 'hFrameCurrent' to objectid 'hFrameNew
  40. 'refresh continue'
  41.  
  42. EXIT
  43.  
  44. VERIFYFRAME:
  45. /* CHECK AND SEE IF A TEXT FRAME IS SELECTED */
  46.     'getcursor type objtype'
  47.     if RC>0 | objtype='TEXTOBJ' then do
  48.         call doalert('The insertion point must be in a text frame to use this macro.')
  49.         EXIT
  50.     end
  51. RETURN
  52.  
  53. GETFRAMEINFO:
  54. /* GET INFO ON THE CURRENT FRAME */
  55.  
  56.     /* FIND HOW MANY FRAMES ARE IN THE ARTICLE, AND THE CURRENT FRAME'S ID */
  57.     'getcursor framestart iFrameSelect'
  58.     'getarticle frames aFrames'
  59.     iFrameCount=aFrames.count-1
  60.     iFrameSelect=iFrameSelect
  61.     hFrameCurrent=aFrames.iFrameSelect
  62.     iFrameLast=aFrames.iFrameCount
  63.  
  64.     /* CHECK THAT THERE ARE NO LINKED FRAMES AFTER THE CURRENT FRAME */
  65.     if hFrameCurrent~=iFrameLast then do
  66.         call doalert('There are linked text frames after the current one!.')
  67.         EXIT
  68.     end
  69.  
  70.     /* GET THE CURRENT PAGE # */
  71.     'currentpage'
  72.         iCurrentPage = result
  73.  
  74.     /* GET INFO ON THE CURRENT FRAME */
  75.     getcolumn position sPos columns number gutter space rotation sPos about sPos constrain cflag print pflag
  76.  
  77. RETURN
  78.  
  79. OPENLIBS:
  80.     /* OPEN LIBRARIES */
  81.     IF ~SHOW('L','rexxsupport.library') THEN
  82.         call addlib('rexxsupport.library',0,-30)
  83.     IF ~SHOW('L','softlogik:libs/slarexxsupport.library') THEN
  84.         call addlib("softlogik:libs/slarexxsupport.library", 0, -30)
  85. RETURN
  86.  
  87. DOALERT:
  88. parse arg sAlertText
  89. iAlertLength=length(sAlertText)
  90. /* Display an alert requester */
  91.     allocarexxrequester '"Macro Alert"' iAlertLength*8+24 55
  92.         hAlertReq=result
  93.     addarexxgadget hAlertReq TEXT 8 12 iAlertLength*8+8 border none string '"'sAlertText'"'
  94.     addarexxgadget hAlertReq EXIT iALertLength*8-58 38 70 label "_Exit"
  95.     doarexxrequester hAlertReq
  96.     freearexxrequester hAlertReq
  97. RETURN
  98.